﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;

namespace Opdracht_3
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(@"App_Data\Vacaturebank.mdb") + ";Persist Security Info=False";
            OleDbConnection dbconnectie = new OleDbConnection(strConn);

            OleDbCommand cmd = new OleDbCommand("SELECT baan FROM vacacures where uren > 35", dbconnectie);

            dbconnectie.Open();
            OleDbDataReader read = cmd.ExecuteReader();
            string baan = "";
            Label1.Text = "";


            while (read.Read())
            {
                baan = read["baan"].ToString();
                Label1.Text += baan + Environment.NewLine;

            }
            dbconnectie.Close();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(@"App_Data\Vacaturebank.mdb") + ";Persist Security Info=False";
            OleDbConnection dbconnectie = new OleDbConnection(strConn);

           
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(@"App_Data\Vacaturebank.mdb") + ";Persist Security Info=False";
            OleDbConnection dbconnectie = new OleDbConnection(strConn);

            OleDbCommand cmd = new OleDbCommand("DELETE FROM vacacures WHERE uren < 35", dbconnectie);
            
            dbconnectie.Open();

            cmd.ExecuteNonQuery();

            dbconnectie.Close();

            dbconnectie.Close();

            
        }
    }
}

